#ifndef HTTPPARSER_H
#define HTTPPARSER_H

#include <QObject>
#include "httprequest.h"
#include "connection.h"
#include "httpresponse.h"
#include "servlet.h"
#include "dispatcherservlet.h"
/**
 * Http协议解析器
 * @brief The HttpParser class
 */
class HttpParser : public QObject
{
    Q_OBJECT
private:
    //根据uri获取对应的servlet
    DispatcherServlet * dispacherServlet = nullptr;
    /**
     * 解析请求参数
     * @brief parseParams
     * @param paramsLine
     */
    void parseParams(HttpRequest * request, QString& paramsLine);
    /**
     * 创建request对象
     * @brief createHttpRequest
     * @param conn
     * @return
     */
     void  createHttpRequest(HttpRequest * request, Connection * conn);

public:
    explicit HttpParser(QObject *parent = nullptr);
    ~HttpParser();

     /**
     * 服务
     * @brief service
     */
    void service(Connection *conn);


signals:

public slots:
};

#endif // HTTPPARSER_H
